﻿<?php 
require("config.php");
$con = @mysql_connect($mysql_host, $mysql_user, $mysql_password);
if (!$con) {
	die("Lỗi" . mysql_error());
}
$db_selected = @mysql_select_db($mysql_db);
if (!$db_selected) {
	die("Lỗi" . mysql_error());
}
$sql="SELECT *FROM friends WHERE user_id=".$_COOKIE["user_id"]."and friend_id=".$_GET["id"];
$result=mysql_query($sql);
$rows=mysql_num_rows($result);
$i=2;
if($rows)
{
	$i=1;
	//ban
}
else
{
	$i=0;
	//ko ban
}
$sql="SELECT role FROM enroll WHERE user_id=".$_COOKIE["user_id"]."and course_id=".$_GET["id"];
$result=mysql_query($sql);
$rows=mysql_num_rows($result);
$u=2;
if($rows)
{
	if(role==0)
	$u=1;
	//neu stu
	else
	$u=3;
	//ta
}
else
{
	$i=0;
	//neu ko tham gia
}
?>